<template>
  <a-modal title='商品退货申请' v-model='visible' v-if='visible' width='650px' height='400px' @cancel='this.visible = false' @ok='handleSubmit'>
    <f-form ref='tuiForm' :action='api.hyOrderDetails.tuibuhuo' v-if='visible' :form-key='this.formItem.orderDetailsId'>
      <f-form-item label='退货数量' type='number' data-type='number' name='saleNum' :required='true' :disabled='true' :value='formItem.saleNum' :max='formItem.saleNum' />
      <f-form-item label='退货日期' type='date' name='saleDate' :value='formItem.saleDate' />
    </f-form>
  </a-modal>
</template>
<script>
import api from "../../../js/api"

export default {
  name: "TuiModal",
  props: {},
  data() {
    return {
      refs: this.$refs,
      api: Object.assign(api, this.api),
      loading: false,
      visible: false,
      formItem: this.getFormItem(),
      queryParam: {}
    }
  },
  watch: {},
  methods: {
    getFormItem() {
      return {
        orderDetailsId: "",
        returnNum: 0,
        saleNum: 0,
        saleAmount: 0,
        saleDate: null
      }
    },
    open(record) {
      if (record) {
        this.formItem = record
      }
      this.visible = true
    },
    handleSubmit() {
      let params = {
        orderDetailsId: this.formItem.orderDetailsId,
        saleNum: this.formItem.saleNum
      }
      this.$refs["tuiForm"].submit(params, () => {
        this.$emit("success")
        this.visible = false
      })
    }
  },
  created() {
  },
  components: {}
}
</script>

<style scoped lang='less' rel='stylesheet/less'>

</style>
